<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<meta name="layout" content="main" />
        <link rel="stylesheet" href="${createLinkTo(dir:'css',file:'auction.css')}" />
		<title>Aukcje</title>
	</head>
	<body>

		<div class="nav">
            <g:ifAllGranted role="ROLE_ADMIN">
                <span class="menuButton"><g:link class="create" action="create">Nowa aukcja</g:link></span>
            </g:ifAllGranted>
		</div>

		<div class="body">
			<h1>Lista aukcji</h1>
			<g:if test="${flash.message}">
			<div class="message">${flash.message}</div>
			</g:if>
			<div class="auctions">
                <g:render template="auction" var="auction" collection="${auctions}" />
			</div>

			<div class="paginateButtons">
                <g:ifAllGranted role="ROLE_ADMIN">
                    <g:paginate total="${Auction.count()}" />
                </g:ifAllGranted>
                <g:ifNotGranted role="ROLE_ADMIN">
                    <g:paginate total="${Auction.findAllByBeginLessThan(new Date()).size()}" />
                </g:ifNotGranted>
			</div>

		</div>
	</body>
</html>

